/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package app.entity;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author Deviant
 */
@Entity
@Table(name = "Property", catalog = "mysweethome", schema = "dbo")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Property.findAll", query = "SELECT p FROM Property p"),
    @NamedQuery(name = "Property.findByPropertyId", query = "SELECT p FROM Property p WHERE p.propertyId = :propertyId"),
    @NamedQuery(name = "Property.findByCountry", query = "SELECT p FROM Property p WHERE p.country = :country"),
    @NamedQuery(name = "Property.findByCity", query = "SELECT p FROM Property p WHERE p.city = :city"),
    @NamedQuery(name = "Property.findByDistrict", query = "SELECT p FROM Property p WHERE p.district = :district"),
    @NamedQuery(name = "Property.findByAddress", query = "SELECT p FROM Property p WHERE p.address = :address"),
    @NamedQuery(name = "Property.findByNoOfBedroom", query = "SELECT p FROM Property p WHERE p.noOfBedroom = :noOfBedroom"),
    @NamedQuery(name = "Property.findByNoOfBathroom", query = "SELECT p FROM Property p WHERE p.noOfBathroom = :noOfBathroom"),
    @NamedQuery(name = "Property.findByPrice", query = "SELECT p FROM Property p WHERE p.price = :price"),
    @NamedQuery(name = "Property.findByImage", query = "SELECT p FROM Property p WHERE p.image = :image"),
    @NamedQuery(name = "Property.findByDescription", query = "SELECT p FROM Property p WHERE p.description = :description"),
    @NamedQuery(name = "Property.findByIsUsed", query = "SELECT p FROM Property p WHERE p.isUsed = :isUsed"),
    @NamedQuery(name = "Property.findByStatus", query = "SELECT p FROM Property p WHERE p.status = :status"),
    @NamedQuery(name = "Property.findByModeOfPay", query = "SELECT p FROM Property p WHERE p.modeOfPay = :modeOfPay"),
    @NamedQuery(name = "Property.findByRent", query = "SELECT p FROM Property p WHERE p.rent = :rent"),
    @NamedQuery(name = "Property.findByDeposit", query = "SELECT p FROM Property p WHERE p.deposit = :deposit"),
    @NamedQuery(name = "Property.findByTypeHouse", query = "SELECT p FROM Property p WHERE p.typeHouse = :typeHouse"),
    @NamedQuery(name = "Property.findByModeOfTransport", query = "SELECT p FROM Property p WHERE p.modeOfTransport = :modeOfTransport"),
    @NamedQuery(name = "Property.findByIsfurniture", query = "SELECT p FROM Property p WHERE p.isfurniture = :isfurniture"),
    @NamedQuery(name = "Property.findByDatePost", query = "SELECT p FROM Property p WHERE p.datePost = :datePost")})
public class Property implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @NotNull
    @Column(name = "property_id", nullable = false)
    private Integer propertyId;
    @Size(max = 30)
    @Column(name = "country", length = 30)
    private String country;
    @Size(max = 30)
    @Column(name = "city", length = 30)
    private String city;
    @Size(max = 30)
    @Column(name = "district", length = 30)
    private String district;
    @Size(max = 30)
    @Column(name = "address", length = 30)
    private String address;
    @Column(name = "no_Of_Bedroom")
    private Integer noOfBedroom;
    @Column(name = "no_Of_Bathroom")
    private Integer noOfBathroom;
    // @Max(value=?)  @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
    @Column(name = "price", precision = 53)
    private Double price;
    @Size(max = 50)
    @Column(name = "image", length = 50)
    private String image;
    @Size(max = 50)
    @Column(name = "description", length = 50)
    private String description;
    @Basic(optional = false)
    @NotNull
    @Column(name = "isUsed", nullable = false)
    private boolean isUsed;
    @Basic(optional = false)
    @NotNull
    @Column(name = "status", nullable = false)
    private boolean status;
    @Size(max = 50)
    @Column(name = "mode_of_pay", length = 50)
    private String modeOfPay;
    @Column(name = "rent", precision = 53)
    private Double rent;
    @Column(name = "deposit", precision = 53)
    private Double deposit;
    @Size(max = 30)
    @Column(name = "type_house", length = 30)
    private String typeHouse;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 50)
    @Column(name = "mode_of_transport", nullable = false, length = 50)
    private String modeOfTransport;
    @Basic(optional = false)
    @NotNull
    @Column(name = "isfurniture", nullable = false)
    private boolean isfurniture;
    @Basic(optional = false)
    @NotNull
    @Column(name = "date_post", nullable = false)
    @Temporal(TemporalType.TIMESTAMP)
    private Date datePost;
    @JoinColumn(name = "type_id", referencedColumnName = "type_id", nullable = false)
    @ManyToOne(optional = false)
    private PropertyType typeId;
    @JoinColumn(name = "username", referencedColumnName = "username", nullable = false)
    @ManyToOne(optional = false)
    private Account username;

    public Property() {
    }

    public Property(Integer propertyId) {
        this.propertyId = propertyId;
    }

    public Property(Integer propertyId, boolean isUsed, boolean status, String modeOfTransport, boolean isfurniture, Date datePost) {
        this.propertyId = propertyId;
        this.isUsed = isUsed;
        this.status = status;
        this.modeOfTransport = modeOfTransport;
        this.isfurniture = isfurniture;
        this.datePost = datePost;
    }

    public Integer getPropertyId() {
        return propertyId;
    }

    public void setPropertyId(Integer propertyId) {
        this.propertyId = propertyId;
    }

    public String getCountry() {
        return country;
    }

    public void setCountry(String country) {
        this.country = country;
    }

    public String getCity() {
        return city;
    }

    public void setCity(String city) {
        this.city = city;
    }

    public String getDistrict() {
        return district;
    }

    public void setDistrict(String district) {
        this.district = district;
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    public Integer getNoOfBedroom() {
        return noOfBedroom;
    }

    public void setNoOfBedroom(Integer noOfBedroom) {
        this.noOfBedroom = noOfBedroom;
    }

    public Integer getNoOfBathroom() {
        return noOfBathroom;
    }

    public void setNoOfBathroom(Integer noOfBathroom) {
        this.noOfBathroom = noOfBathroom;
    }

    public Double getPrice() {
        return price;
    }

    public void setPrice(Double price) {
        this.price = price;
    }

    public String getImage() {
        return image;
    }

    public void setImage(String image) {
        this.image = image;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public boolean getIsUsed() {
        return isUsed;
    }

    public void setIsUsed(boolean isUsed) {
        this.isUsed = isUsed;
    }

    public boolean getStatus() {
        return status;
    }

    public void setStatus(boolean status) {
        this.status = status;
    }

    public String getModeOfPay() {
        return modeOfPay;
    }

    public void setModeOfPay(String modeOfPay) {
        this.modeOfPay = modeOfPay;
    }

    public Double getRent() {
        return rent;
    }

    public void setRent(Double rent) {
        this.rent = rent;
    }

    public Double getDeposit() {
        return deposit;
    }

    public void setDeposit(Double deposit) {
        this.deposit = deposit;
    }

    public String getTypeHouse() {
        return typeHouse;
    }

    public void setTypeHouse(String typeHouse) {
        this.typeHouse = typeHouse;
    }

    public String getModeOfTransport() {
        return modeOfTransport;
    }

    public void setModeOfTransport(String modeOfTransport) {
        this.modeOfTransport = modeOfTransport;
    }

    public boolean getIsfurniture() {
        return isfurniture;
    }

    public void setIsfurniture(boolean isfurniture) {
        this.isfurniture = isfurniture;
    }

    public Date getDatePost() {
        return datePost;
    }

    public void setDatePost(Date datePost) {
        this.datePost = datePost;
    }

    public PropertyType getTypeId() {
        return typeId;
    }

    public void setTypeId(PropertyType typeId) {
        this.typeId = typeId;
    }

    public Account getUsername() {
        return username;
    }

    public void setUsername(Account username) {
        this.username = username;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (propertyId != null ? propertyId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Property)) {
            return false;
        }
        Property other = (Property) object;
        if ((this.propertyId == null && other.propertyId != null) || (this.propertyId != null && !this.propertyId.equals(other.propertyId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "app.entity.Property[ propertyId=" + propertyId + " ]";
    }
    
}
